package com.ruoyi.project.exam.controller;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.exam.domain.PaperModel;
import com.ruoyi.project.exam.service.IPaperService;
@Controller
@RequestMapping("/exam/myExam")
public class MyExamController extends BaseController{
	
	private String prefix = "exam/myExam";
	@Autowired
	private IPaperService paperService;
	
	@RequiresPermissions("exam:myExam:view")
	@GetMapping()
	public String myExam(ModelMap mmap) {
		return prefix + "/myExam";
	}
	
	/**
	 * 查询列表
	 */
	@RequiresPermissions("exam:myExam:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(PaperModel model) {
		startPage();
		model.setUserId(ShiroUtils.getUserId());
		List<PaperModel> list = paperService.selectUserPaperList(model);
		return getDataTable(list);
	}
}
